package tests;

import javax.xml.parsers.ParserConfigurationException;
import javax.xml.transform.TransformerException;

import utilities.NVSupervisorCreator;
import utilities.XMLWriter;
import model.TransitionSystem;

/** Class for testing supervisor creation for graph without variables
 * @author DarkoLaptop2
 *
 */
public class SupervisorAlghorithmsTester {
	/**Main method
	 * @param args
	 * @throws ParserConfigurationException
	 * @throws TransformerException
	 */
	public static void main(String[] args) throws ParserConfigurationException, TransformerException{
//		TransitionSystem graph=new TransitionSystem();
//		graph.addNode(0, "0");
//		graph.addNode(1, "1");
//		graph.addNode(2, "2");
//		graph.addNode(3, "3");
//		graph.addNode(4, "4");
//		graph.addNode(5, "5");
//		graph.addNode(6, "6");
//		graph.addNode(7, "7");
//		graph.addNode(8, "8");
//		graph.addNode(9, "9");
//		graph.addEdge(0, "a", 1);
////		graph.addEdge(0,"b",2);
//		graph.addEdge(0,"c",3);
//		graph.addEdge(1,"c",2);
//		graph.addEdge(1,"a",4);
//		graph.addEdge(1,"b",5);
//		graph.addEdge(2,"b",6);
//		graph.addEdge(2,"c",7);
//		graph.addEdge(3,"a",2);
//		graph.addEdge(3,"b",8);
//		graph.addEdge(3,"c",9);
//		graph.addEdge(6,"b",7);
//		System.out.println(graph.toStringTransitionPrint());
//		graph.setInitialNode(0);
////		graph.setBadNode(7);
////		graph.setBadNode(9);
//		graph.setBadNode(2);
//		graph.setTransitionType("b", false);
//		graph.setTransitionType("c", false);		
//		TransitionSystem supervisor=NVSupervisorCreator.createFromDeterministic(graph);
//		System.out.println(supervisor.toStringTransitionPrint());
//		System.out.println(graph.getMaxDepth());
//		System.out.println(graph.generateAllPaths());
		
		TransitionSystem graph2=new TransitionSystem();
		graph2.addNode(0,"0");
		graph2.addNode(1,"1");
		graph2.addNode(2,"2");
		graph2.addNode(3,"3");
		graph2.addNode(4,"4");
		graph2.addNode(5,"5");
		graph2.addNode(6,"6");
		graph2.addNode(7,"7");
		graph2.addNode(8,"8");
		graph2.addEdge(0,"a",1);
		graph2.addEdge(0,"a",2);
		graph2.addEdge(0,"b",3);
		graph2.addEdge(1,"a",0);
		graph2.addEdge(1,"c",4);
		graph2.addEdge(1,"b",5);
		graph2.addEdge(1,"c",6);
		graph2.addEdge(1,"b",2);
		graph2.addEdge(2,"c",6);
		graph2.addEdge(4,"b",8);
		graph2.addEdge(6,"b",7);
		graph2.setInitialNode(0);
//		System.out.println(graph2.getMaxDepth());
//		System.out.println(graph2.generateAllPaths());
//		System.out.println(graph2.getAllNodesWithSameTrace("a c b"));
		graph2.setBadNode(7);
		graph2.setTransitionType("b", false);
		TransitionSystem supervisor2=NVSupervisorCreator.createFromNondeterministic(graph2);
		System.out.println(supervisor2.toStringTransitionPrint());
		XMLWriter.writeXMLDocumentForSupervisor(graph2, "input.jff");
		XMLWriter.writeXMLDocumentForSupervisor(supervisor2, "output.jff");
		
	}
}
